package com.wangjie.order.interceptor;

import feign.InvocationContext;
import feign.Response;
import feign.ResponseInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * feign响应拦截器
 */
@Slf4j
@Component
public class CustomResponseInterceptor implements ResponseInterceptor {
    @Override
    public Object intercept(InvocationContext invocationContext, Chain chain) throws Exception {
        Response response = invocationContext.response();
        log.info("Response status: {}", response.status());
        log.info("Response headers: {}", response.headers());
        Object result = invocationContext.proceed();
        log.info("result: {}", result);
        return result;
    }
}